package com.sunmouse.toolkit.widget;

import android.content.Context;
import android.util.AttributeSet;

import com.handmark.pulltorefresh.library.PullToRefreshScrollView;

/**
 * Created by leiyun on 2018/4/18.
 */
public class RefreshScrollView extends PullToRefreshScrollView {

    private float x0;
    private float y0;
    private float x1;
    private float y1;
    private float deltaX;
    private float deltaY;

    public RefreshScrollView(Context context) {
        super(context);
    }

    public RefreshScrollView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public RefreshScrollView(Context context, Mode mode) {
        super(context, mode);
    }


//    @Override
//    public boolean onInterceptTouchEvent(MotionEvent ev) {
//        switch (ev.getAction()) {
//            case MotionEvent.ACTION_DOWN:
//                x0 = ev.getX();
//                y0 = ev.getY();
////                LogUtils.v("----------x0p=" + ev.getXPrecision());
//                break;
//            case MotionEvent.ACTION_MOVE:
//                x1 = ev.getX();
//                y1 = ev.getY();
////                LogUtils.v("----------x1p=" + ev.getXPrecision());
//                break;
//            case MotionEvent.ACTION_UP:
//                x1 = ev.getX();
//                y1 = ev.getY();
//                break;
//        }
//        LogUtils.v("--x0=" + x0 + "--y0=" + y0 + "--x1=" + x1 + "--y1=" + y1);
//        deltaX = x1 - x0;
//        deltaY = y1 - y0;
//        if (Math.abs(deltaX) > Math.abs(deltaY))  //水平偏移量>竖直偏移量
//            return false;
//        super.onInterceptTouchEvent(ev);
//        return true;
//    }

//    @Override
//    public boolean onTouchEvent(MotionEvent event) {
//        if (Math.abs(deltaX) > Math.abs(deltaY))  //水平偏移量>竖直偏移量
//            return true;
//        return super.onTouchEvent(event);
//    }
}
